﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AllPurposeCard.yixin
{
    public partial class Denglu : Form
    {
        public Denglu()
        {
            InitializeComponent();
        }

        private void Chongzhi1_Click(object sender, EventArgs e)
        {
            //重置账号框
            LoginId.Text = "";
        }

        private void Chongzhi2_Click(object sender, EventArgs e)
        {

            //重置密码框
            LoginPwd.Text = "";
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //获取用户输入的账号和密码
            string UserLoginID = this.LoginId.Text.Trim();
            string UserPassWord = this.LoginPwd.Text;
            //非空验证
            if (UserLoginID=="")
            {
                MessageBox.Show("账号不能为空！");
            }
            if (UserPassWord == "")
            {
                MessageBox.Show("密码不能为空！");
            }
            //判断用户ID与密码是否匹配
            bool result = Program.CheckLogin(UserLoginID, UserPassWord);
            if (result)
            {
                yixin.entirety Mp = new yixin.entirety();
                this.Hide();
                Mp.Show();
            }
            else
            {
                MessageBox.Show("账号密码错误", "提示", MessageBoxButtons.OK);
            }
        }

        private void Quxiao_Click(object sender, EventArgs e)
        {
            DialogResult re = MessageBox.Show("确定要取消吗？", "", MessageBoxButtons.YesNo);
            if (re==DialogResult.Yes)
            {
                this.Close();
            }
        }
    }
}
